﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using BLL;
using System.Net;
using System.IO;

namespace GUI.UserInterfaces
{
    public partial class GUIMain : Form
    {
        private static GUIMain instance = null;
        private static readonly object padlock = new object();

        public GUIMain()
        {
            InitializeComponent();
        }

        private void btnAbout_Click(object sender, EventArgs e)
        {
            GUIAbout.ShowForm();
        }

        public static GUIMain Instance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new GUIMain();
                    }

                    return instance;
                }
            }
        }

        private void btnFolder_Click(object sender, EventArgs e)
        {
            if (Directory.Exists(UTIL.KZSettings.DemoFolder))
            {
                System.Diagnostics.Process prc = new System.Diagnostics.Process();
                prc.StartInfo.FileName = UTIL.KZSettings.DemoFolder.Substring(0, UTIL.KZSettings.DemoFolder.Length - 1);
                prc.Start();
            }
            else
            {
                MessageBox.Show(null, "You do not have any demos downloaded therefore you do not have a demo folder", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
